Skip to content

feat(read): prune Parquet row groups for multi-file data evolution - #607

Open
linchen1101 wants to merge 1 commit into
apache:mainfrom
linchen1101:main-support-data-evolution-multi-files-push-down
Open

linchen1101 wants to merge 1 commit into
apache:mainfrom
linchen1101:main-support-data-evolution-multi-files-push-down

Conversation

@linchen1101

@linchen1101 linchen1101 commented Dec 2, 2026 •

Copy link
Copy Markdown

Purpose

Linked issue: Closes #616

Data Evolution can store columns from the same rows in separate Parquet files. Use the newest file for each predicate field and intersect candidate row ID ranges before merging. Keep residual filtering after the merge for exact results, and account for footer I/O when an entire file group is pruned.

Tests

  • DataEvolutionTableTest.TestMergedParquetRowGroupPredicatePushDown covers cross-file predicates, residual filtering, and files with different row-group boundaries on an unbucketed table. It also covers skipped-group metrics for direct reads and parallel prefetch with and without read-ahead caching.
  • DataEvolutionTableTest.TestMergedParquetPushDownWithOverwrittenNestedField covers filtering on a base-file column while reading an evolved nested field from its replacement file.
  • Updated DataEvolutionTableTest.TestPartitionWithPredicate to cover the intersection of Parquet row-group pruning and explicit row ID ranges.

API and Format

Adds the optional RowGroupFilter interface in include/paimon/reader/file_batch_reader.h for obtaining candidate row ranges and reporting metadata I/O for skipped readers. The optimization uses existing Parquet footer metadata and Paimon row IDs. Storage format and protocol impact is zero.

Documentation

The optimization applies automatically to eligible multi-file Data Evolution Parquet reads using existing reader settings.

Generative AI tooling

Generated-by: OpenAI Codex (gpt-6.2-sol)

@linchen1101

Copy link
Copy Markdown
Author

@lxy-9602 有空的时候帮忙review一下?针对data evolution 跨文件的谓词下推支持。

Use the newest file for each predicate field and intersect candidate row ID ranges before merging. Cover cross-file predicates and residual filtering in the Data Evolution regression.
@linchen1101
linchen1101 force-pushed the main-support-data-evolution-multi-files-push-down branch from 404e1ff to 5bc536d Compare December 3, 2026 07:37
@lxy-9602

lxy-9602 commented Dec 3, 2026 •

Copy link
Copy Markdown
Member

Thank you for your contribution! Before the code review, please prepare an issue for the new feature and link it to the PR. Also, could you please use English in comments? Thanks!

@linchen1101

Copy link
Copy Markdown
Author

Sorry for writing my earlier comments in Chinese. I’ve linked issue #616 to PR #607 and would appreciate your review when you have time. @lxy-9602

@apache apache deleted a comment from linchen1101 Dec 3, 2026
ConcatBatchReader(std::vector<std::unique_ptr<BatchReader>>&& readers,
const std::shared_ptr<arrow::MemoryPool>& arrow_pool);
const std::shared_ptr<arrow::MemoryPool>& arrow_pool,
std::shared_ptr<Metrics> finished_reader_metrics = nullptr);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please avoid using default parameters in production code under src. If the change is relatively large, consider adding an overloaded constructor instead.


void PrefetchFileBatchReaderImpl::CollectPrefetchMetrics(
const std::shared_ptr<Metrics>& result) const {
auto set_prefetch_counter = [&result](const char* name, const std::atomic<uint64_t>& value) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since result is a standard out parameter that doesn’t require ownership, I suggest using a raw pointer to make it explicit.

const std::shared_ptr<DataFilePathFactory>& data_file_path_factory,
const RoaringBitmap32* exact_selection) const;
const RoaringBitmap32* exact_selection,
std::unique_ptr<FileBatchReader> opened_reader = nullptr) const;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please avoid default parameters, or alternatively add a new overload and remove unrelated parameters like reader_builder, etc.

/// files sharing one row-id range shares the intersection of its file-index selections across
/// all child readers to preserve alignment.
/// files with the same row-id range shares a selection from file indexes and Parquet row-group
/// statistics across all child readers to preserve alignment.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In core/common code, we don’t explicitly state that it must be Parquet (or give Parquet as an example), because it’s a format plugin.


std::optional<RoaringBitmap32> SelectByRowGroupStats(
const std::shared_ptr<DataFileMeta>& file, const std::shared_ptr<Predicate>& predicate,
const DataFilePathFactory& data_file_path_factory, OpenedFileReaders& opened_readers) const;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please avoid OpenedFileReaders&. If it’s an output parameter, use a pointer directly; otherwise use const& to make it explicit. Also, please avoid default parameters. Thanks!

std::all_of(files.begin(), files.end(), [](const auto& file) {
return DataEvolutionUtils::IsNormalFile(file->file_name) &&
StringUtils::EndsWith(file->file_name, ".parquet") &&
file->row_count <= std::numeric_limits<int32_t>::max();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

StringUtils::EndsWith(file->file_name, ".parquet") feels too tailored. Could we adjust it to avoid hardcoding Parquet specifically? At least, we should use DataFileMeta->FileFormat() instead of checking the .parquet suffix.

file->row_count <= std::numeric_limits<int32_t>::max();
});
if (!use_file_indexes && !can_use_row_group_stats) {
return std::optional<RoaringBitmap32>();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Java, we enable the corresponding feature via the data-evolution.merged-read.stats-pushdown.enabled configuration. Please add this config to both defs and core_options.

/// files with the same row-id range shares a selection from file indexes and Parquet row-group
/// statistics across all child readers to preserve alignment.
///
/// Deletion vectors are supported: a row range group's vector is maintained against the

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’d also like to ask: is there any plan to support page index filtering in the future? If so, please add a TODO describing that it’s currently a subset of the Java functionality (apache/paimon#10394) , and that we plan to add the remaining parts later.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Support multi-file Parquet predicate pushdown in Data Evolution

2 participants